package org.example.stu;



import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Objects;


public class CommonTools {



    public static String readSqlFile(String filePath) throws IOException {
        StringBuilder content = new StringBuilder();

        // 根据项目文件自定义路径跳转
        String sqlPath = Objects.requireNonNull(TestReadSql.class.getClassLoader().getResource(filePath)).getPath();;

        try (BufferedReader reader = new BufferedReader(new FileReader(sqlPath))) {
            String line;
            while ((line = reader.readLine()) != null) {
                content.append(line).append("\n");
            }
        }
        return content.toString();
    }





}
